Elder’s Force Index (FI) v2: Technical Indicator for Market Momentum Analysis
Table of Contents
Elder’s Force Index (FI) v2: Technical Indicator for Market Momentum Analysis
Introduction
The Elder’s Force Index (FI) is a powerful momentum oscillator developed by Dr. Alexander Elder that measures the force (or power) behind price movements by combining price changes and volume. This version 2 implementation enhances the original indicator with improved color visualization to better highlight bullish and bearish momentum shifts.
How It Works
The Force Index uses price movement and volume to assess the strength of market moves. It helps traders identify potential trend reversals, confirm breakouts, and spot divergences.
Formula
The Elder’s Force Index is calculated using the following formula:
Raw Force Index = (Current Close - Previous Close) × Volume
To reduce market noise, an Exponential Moving Average (EMA) is applied:
Smoothed Force Index = EMA(Raw Force Index, Length)
Where Length is typically set to 13 periods (default) but can be adjusted based on trading preferences.
Interpretation
- Positive Force Index (Green): Indicates bullish momentum where buyers are in control
- Negative Force Index (Red): Indicates bearish momentum where sellers are in control
- Zero Line Crossovers: Potential shift in short-term momentum
- Divergences: When price makes new highs/lows but Force Index doesn’t confirm
Trading Strategies
The Force Index can be used in several trading approaches:
- Trend Confirmation: A sustained positive Force Index confirms an uptrend, while a sustained negative value confirms a downtrend
- Zero Line Strategy: Buy when the Force Index crosses above zero, sell when it crosses below
- Divergence Trading: Look for divergences between price action and the Force Index to identify potential reversals
- Volume Surge Analysis: Extreme Force Index readings indicate high volume price moves that may signal the beginning of a new trend
Code Implementation
Indie Version (v5)
#education purpose
# indie:lang_version = 5
from indie import indicator, plot, color, param, MutSeriesF
from indie.algorithms import Ema
@indicator("Elder's Force Index (FI)", overlay_main_pane=False)
@param.int('length', default=13, min=1, title='EMA Length')
@plot.line(id='#plot_0')
def Main(self, length):
# Create a mutable time series for the Force Index
fi_series = MutSeriesF.new((self.close[0] - self.close[1]) * self.volume[0])
# Apply exponential smoothing
smoothed_fi = Ema.new(fi_series, length)[0]
# Determine the color of the indicator line
fi_color = color.GREEN if smoothed_fi > 0 else color.RED
return plot.Line(smoothed_fi, color=fi_color)
PineScript Version (v5)
//@version=5
indicator("Elder's Force Index (FI)", overlay=false)
// Input parameter
length = input.int(13, "EMA Length", minval=1)
// Calculate Force Index
fi_series = (close - close[1]) * volume
// Apply exponential smoothing
smoothed_fi = ta.ema(fi_series, length)
// Plot the indicator with color based on value
plot(smoothed_fi, "Force Index", color=smoothed_fi > 0 ? color.green : color.red)
Syntax Comparison: PineScript vs. Indie
For developers transitioning from PineScript to Indie, here are the key syntax differences:
- Module Imports: Indie requires explicit imports (
from indie import...
) while PineScript has built-in functions - Series Handling:
- PineScript implicitly handles time series data
- Indie requires explicit indexing with
[0]
,[1]
for accessing current and historical values
- Parameter Declaration:
- PineScript:
length = input.int(13, "EMA Length", minval=1)
- Indie:
@param.int('length', default=13, min=1, title='EMA Length')
- PineScript:
- Series Creation:
- PineScript automatically creates series from expressions
- Indie requires explicit series creation using
MutSeriesF.new()
- Function Structure:
- PineScript uses global scope
- Indie uses a function-based approach with a
Main
function that takes parameters
- Plotting:
- PineScript:
plot()
function calls - Indie: Uses decorators for plot settings and returns values or plot objects
- PineScript:
Advantages of Indie
- Type Safety: Indie’s explicit typing helps catch errors during development
- Modularity: Imports and function-based approach encourage better code organization
- Object-Oriented: Support for classes and objects allows for more sophisticated indicators
- Python Compatibility: Familiar syntax for Python developers
- Explicit Series Handling: While more verbose, the explicit series handling makes data flow clearer
Customization Options
The Force Index can be customized by:
- Adjusting the
length
parameter (shorter for faster signals, longer for smoother trends) - Applying additional smoothing for noise reduction
- Adding bands or thresholds to identify overbought/oversold conditions
- Combining with other indicators for confirmation signals